package com.hjc.oj.judge.codesandbox.impl;

import com.hjc.oj.judge.codesandbox.CodeSandBox;
import com.hjc.oj.judge.codesandbox.model.ExecuteCodeRequest;
import com.hjc.oj.judge.codesandbox.model.ExecuteCodeResponse;
import com.hjc.oj.judge.codesandbox.model.JudgeInfo;
import com.hjc.oj.model.enums.JudgeInfoMessageEnum;
import com.hjc.oj.model.enums.QuestionSubmitSatatusEnum;
import lombok.extern.log4j.Log4j2;
import java.util.List;

/***
 * 示例代码沙箱
 */
@Log4j2
public class ExampleCodeSandBox implements CodeSandBox {

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
//        System.out.println("示例代码沙箱");
        List<String> inputList = executeCodeRequest.getInputList();
//        String code = executeCodeRequest.getCode();
//        String language = executeCodeRequest.getLanguage();


        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试成功");
        executeCodeResponse.setStatus(QuestionSubmitSatatusEnum.SUCCEED.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setMemory(100l);
        judgeInfo.setTime(100l);
        executeCodeResponse.setJudgeInfo(judgeInfo);
        return executeCodeResponse;
    }
}
